var ChangeManaged = function() {
	return {
		datatable : null,
		/**
		 * 初始状态
		 */
		init : function() {
			this.initListener();
		},
		/**
		 * 监听开关事件
		 */
		initListener : function() {
			$("#editUserInfo").click(function(){
				var form1 = $('#addForm');
				form1.validate({
					rules : {
						realName : {
							minlength : 2,
							maxlength : 50,
							required : true
						},
						phone : {
							maxlength :20
						},
						email : {
							maxlength :100,
							email : true
						},
						address : {
							maxlength :200
						}
					}
				});
				if(form1.valid()){
					var postData = $("form[name='addForm']").serializeJson();
					$.ajax({
						"dataType" : 'json',
						"cache": false,
						"type" : "POST",
						"data" : postData,
						"url" : ctx + "/user/doChangeUserInfo",
						"success" : function(data) {
							if(data.type=='success'){
								BootstrapDialog.show({
									title : messages.public_cue_cue,
									message : messages.public_cue_saveOk,
									buttons : [ {
										label : messages.public_cue_sure,
										cssClass : 'btn btn-sm btn-primary',
										action : function(dialogItself) {
											dialogItself.close();
										}
									} ]
								});
							}else{
								BootstrapDialog.show({
									type : BootstrapDialog.TYPE_WARNING,
									title : messages.public_cue_warning,
									message : data.message,
									buttons : [ {
										label : messages.public_cue_sure,
										cssClass : 'btn btn-sm btn-primary',
										action : function(dialogItself) {
											dialogItself.close();
										}
									} ]
								});
							}
						}
					});
				}
			});
		}
	};

}();